{extend name="index_layout"/}
{block name="main"}
<form class="layui-form" method="post">
    <input type="hidden" name="id" value="{$data.id}"/>
    {:token()}
    <div class="layui-form-item">
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-block">
            <input type="text" name="phone" lay-verify="required" autocomplete="off" placeholder="手机号"
                   class="layui-input" value="{$data.phone}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline">
            <input type="password" name="password" autocomplete="off" placeholder="密码" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">不修改留空即可。</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">确认密码</label>
        <div class="layui-input-inline">
            <input type="password" name="password_confirm" autocomplete="off" placeholder="确认密码"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">

        <div class="layui-form-item">
            <label class="layui-form-label">真实姓名</label>
            <div class="layui-input-block">
                <input type="text" name="name" autocomplete="off" placeholder="真实姓名" class="layui-input"
                       value="{$data.name}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">部门</label>
            <div class="layui-input-block">
                <input type="text" name="class" autocomplete="off" placeholder="部门" class="layui-input"
                       value="{$data.class}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <input type="radio" name="status" checked value="1" title="正常" {if $data.status==1}checked{/if}>
                <input type="radio" name="status" value="0" {if $data.status==0}checked{/if} title="冻结">
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">管理员</label>
            <div class="layui-input-block" onclick="showArea()">
                <input type="radio" name="identity" checked value="0" {if $data.identity==0}checked{/if} title="否">
                <input type="radio" name="identity" value="1" title="是" {if $data.identity==1}checked{/if}>
            </div>
        </div>


        <div class="layui-form-item" id="area" style="display: none">
            <label class="layui-form-label">区域</label>
            <div class="layui-input-inline">
                <input data-source="{:url('admin/area.index/index')}" class="layui-input selectpage" data-field='name'
                       data-primary-key="id" name="aid" type="text" value="{$data.aid}"></div>
        </div>
    </div>


    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script type="text/javascript">
    var identity = $('input[name="identity"]:checked').val();
    if (identity == 1) {
        $('#area').show()
    }

    layui.use('yznForm', function () {
        var yznForm = layui.yznForm;
        yznForm.bindevent($("form.layui-form"));
    });


    function showArea() {
        var identity = $('input[name="identity"]:checked').val();
        if (identity == 1) {
            $('#area').show()
        } else {
            $('#area').hide()
        }
    }

</script>
{/block}